<?
	session_start();
	include_once("../src/functions/basedonnee.php");
	include_once("../src/functions/utils.php");
	include_once("../src/reqsql/tutilisateur.php");
	if(DataBase::connect() == null) {
		redirect("../installation");
		exit;
	}
	$res = DataBase::doSQL($TUTILISATEUR_COUNT);
	if($res['total']==0) {
		redirect("../installation");
		exit;
	}
	if(str_word_count($_SESSION['login'])==0) {
		$res = DataBase::doSQL($TUTILISATEUR_SELECT,array(0=>$_POST['login'],1=>$_POST['motdepasse']));
		$_SESSION['login'] = $res['login'];
	}
	if(str_word_count($_SESSION['login'])==0) {
		redirect("../erreur.php");
		exit;
	}
?>
<html>
	<head>
		<link rel="stylesheet" type="text/css" href="../css/charte.css">
		<title>Plann Tool</title>
	</head>
	<body>
		<table width="100%">
			<tr>
				<td><h1>PlannTool</h1></td>
				<td>Bienvenue <?= $_SESSION['login'] ?></td>
			</tr>
		</table>
		
<script language="javascript">
	function openSubMenu(parent) {
		children = parent.childNodes;
		for(i=0;children[i]!=undefined;i++) {
			if(children[i].id!=undefined) {
				children[i].style.display = "block";
			}
		}
	}
	function closeSubMenu(parent) {
		children = parent.childNodes;
		for(i=0;children[i]!=undefined;i++) {
			if(children[i].id!=undefined) {
				children[i].style.display = "none";
			}
		}
	}
	
</script>

<table width="100%">
	<tr>
		<td width="15%">
		
		<div class="menu" onmouseover="openSubMenu(this)"  onmouseout="closeSubMenu(this)">
			Projet
			<div class="groupe" style="display:none">
				<div class="submenu"
					onmouseover="this.style.backgroundColor='#EEEEEE'"
					onmouseout="this.style.backgroundColor='#FFFFFF'">
					Ajouter un projet
				</div>
				<div class="submenu">
					Voir les projet
				</div>
			</div>
		</div>
		<div class="menu" onmouseover="openSubMenu(this)"  onmouseout="closeSubMenu(this)">
			Mon profil
			<div class="groupe" style="display:none">
				<div class="submenu">
					Voir / Modifier mon profil
				</div>
				<div class="submenu">
					Autre choix
				</div>
			</div>
		</div>
		
		</td>			
		<td>